﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using WebLibs;
using TGVR.Manager.UserControls.Template.MessageBox;

namespace TGVR.Manager.Pages.Template
{
    public class TGVRPageBase : System.Web.UI.Page
    {
        #region data member
        protected MDF.DataHelper.BussinessObject.UsersBO.UserProfile User
        {
            get 
            {
                if (HttpContext.Current.Session["user"] != null)
                    return (HttpContext.Current.Session["user"] as MDF.DataHelper.BussinessObject.UsersBO.UserProfile);
                else
                    return null;
            }
        }

        protected MessageBox MsgBox 
        {
            get
            {
                return Page.Master.FindControl("MessageBox1") as MessageBox;
            }
        }

        private string ErrorPagePath = "/Error.aspx";
        #endregion


        #region methods
        protected void RedirectToErrorPage(string message = null)
        {
            HttpContext.Current.Session["error"] = message;
            HttpContext.Current.Response.Redirect(Globals.ApplicationVRoot() + ErrorPagePath, false);
        }
        #endregion
    }
}